home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / python-rdflib / rdflib / syntax / serializers / AbstractSerializer.py < prev    next >
Encoding:
Python Source  |  2007-04-04  |  457 b   |  19 lines

  1. from rdflib import URIRef
  2.  
  3. class AbstractSerializer(object):
  4.  
  5.     def __init__(self, store):
  6.         self.store = store
  7.         self.encoding = "UTF-8"
  8.         self.base = None
  9.  
  10.     def serialize(self, stream, base=None, encoding=None, **args):
  11.         """Abstract method"""
  12.  
  13.     def relativize(self, uri):
  14.         base = self.base
  15.         if base is not None and uri.startswith(base):
  16.             uri = URIRef(uri.replace(base, "", 1))
  17.         return uri
  18.  
  19.